<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            border: 10px solid red;
            width: 590px;
            position: relative;
            overflow: hidden;
        }
 
        .img {
            list-style: none;
            width: 590px;
            height: 470px;
        }
 
        .img-box {
            margin: 0px;
            padding: 0px;
            position: relative;
            height: 470px;
            width: 590px;
            display: flex;
            transition: 1s;
        }
 
        button {
            position: absolute;
            height: 100px;
            width: 40px;
            background-color: rgba(0, 0, 0, 0.5);
            color: white;
            top: 50%;
            transform: translateY(-50%);
            border: none;
            z-index: 100;
            /* opacity: 0.5; */
        }



.point-box {
    position: absolute;
    list-style: none;
    padding: 0px;
    margin: 0px;
    display: flex;
    width: 100px;
    justify-content: space-between;
    bottom: 20px;
    left: 20px;
}

.point {
    height: 10px;
    width: 10px;
    border-radius: 50%;
    background-color: black;
    color: rgba(0, 0, 0, 0)
}

.active {
    /* z-index: 10; */
    opacity: 1;
}

.pointActive {
    background-color: white;
}
</style>
</head>

<body>
<div>
<ul class="img-box">
    <li class="img active">
        <img src="./1.jpg" alt="">
    </li>
    <li class="img">
        <img src="./2.jpg" alt="">
    </li>
    <li class="img">
        <img src="./3.jpg" alt="">
    </li>
    <li class="img">
        <img src="./4.jpg" alt="">
    </li>
    <li class="img">
        <img src="./5.jpg" alt="">
    </li>

    <li class="img">
        <img src="./6.jpg" alt="">
    </li>
    <li class="img active">
        <img src="./1.jpg" alt="">
    </li>
</ul>
<ul class="point-box">
    <li class="point pointActive">1</li>
    <li class="point">2</li>
    <li class="point">3</li>
    <li class="point">4</li>
    <li class="point">5</li>
    <li class="point">6</li>
</ul>
</div>
<script>

let imgBoxUl = document.querySelector('.img-box')
let imgs = document.querySelectorAll('.img')
let points = document.querySelectorAll('.point')
let index = 0 

setInterval(function () {
    points[index].classList.remove('pointActive')
    index++
    if (index >= 6) {
        imgBoxUl.style.transform = 'translateX(-' + index * 590 + 'px)'
        points[0].classList.add('pointActive')
        setTimeout(function () {
            imgBoxUl.style.transition = '0s'
            index = 0
            imgBoxUl.style.transform = 'translateX(-' + index * 590 + 'px)'
        }, 1000)
    }
    else {
        points[index].classList.add('pointActive')
        imgBoxUl.style.transition = '1s'
        imgBoxUl.style.transform = 'translateX(-' + index * 590 + 'px)'
    }
}, 1000)
</script>

</body>

</html>
